#include "debug.h"
void Uart7_Init();
void uart7_send_string(u8* string,u8 len);
//void usart1_send_string(u8* string,u8 len);
void Uart6_Init();
void uart6_send_string(u8* string,u8 len);


#define RING_BUFFER_LEN     (1024u)

// The length of a single buffer used by DMA
#define RX_BUFFER_LEN       (128u)

#define USART_RX_CH         DMA1_Channel5

/* Global Variable */
struct USART_DMA_CTRL_TypeDef {
    volatile uint8_t DMA_USE_BUFFER;
    uint8_t Rx_Buffer[2][RX_BUFFER_LEN];

};

struct Ring_Buffer_TypeDef {
    uint8_t buffer[RING_BUFFER_LEN];
    volatile uint16_t RecvPos;  //
    volatile uint16_t SendPos;  //
    volatile uint16_t RemainCount;

};

extern struct Ring_Buffer_TypeDef ring_buffer;

void USARTx_CFG(uint32_t baudrate);
void DMA_INIT(void);
void ring_buffer_push_huge(uint8_t *buffer, uint16_t len);
uint8_t ring_buffer_pop();
int usart1_send_data(char *buf, int size);
